<?php 
header("content-type:text/html;charset=utf8");
//连选库
$db=new PDO("mysql:host=127.0.0.1;dbname=bj07c;charset=utf8","root","root");
$sql="select * from goods_qg";
$res=$db->query($sql)->fetchAll(PDO::FETCH_ASSOC);
// print_r($res);die;
foreach ($res as $key => $value) {
	$starttime=$value["starttime"];
	$endtime=$value["endtime"];
}
// print_r($starttime);die;
//获取当前的时间
// $date=strtotime(date("Y-m-d H:i:s"));
$starttime=time();
$endtime=strtotime($endtime);
// print_r($date);die;
$hour=floor(($endtime-$starttime)/3600);
$minute=floor(($endtime-$starttime)/60-($hour*60));
$m=($endtime-$starttime)%60;
// print_r($);die;
echo json_encode(array("hour"=>$hour,"minute"=>$minute,"m"=>$m));
 ?>